package com.mxl.rabbitmq.consumer;

import com.alibaba.fastjson.JSON;
import com.mxl.rabbitmq.config.TopicConfig;
import com.mxl.rabbitmq.model.MessageBody;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.rabbit.annotation.RabbitListener;

/**
 * @author MXL
 * @date 2021/9/14 0014
 **/
//@Component
@Slf4j
public class TopicReceiver {

    @RabbitListener(queues = TopicConfig.QUEUE_NAME_TOPIC_XIAOMI)
    public void xiaomiProcess(MessageBody messageBody) {
        log.info("Topic-xiaomi-Receiver消费者收到消息  : {}", JSON.toJSONString(messageBody));
    }

    @RabbitListener(queues = TopicConfig.QUEUE_NAME_TOPIC_HUAWEI)
    public void huaweiProcess(MessageBody messageBody) {
        log.info("Topic-huawei-Receiver消费者收到消息  : {}", JSON.toJSONString(messageBody));
    }

    @RabbitListener(queues = TopicConfig.QUEUE_NAME_TOPIC_PHONE)
    public void phoneProcess(MessageBody messageBody) {
        log.info("Topic-phone-Receiver消费者收到消息  : {}", JSON.toJSONString(messageBody));
    }
}
